package com.wwewew;

import java.sql.SQLOutput;
import java.util.ArrayList;

public class StudentOPeratorlmpl1 implements StudentOperator{

    @Override
    public void printAllInfo(ArrayList<Student> student) {
        System.out.println("--------全部学生信息如下--------");
        for (int i = 0; i < student.size(); i++) {
            Student s=student.get(i);
            System.out.println("第"+(i+1)+"位同学的信息是");
            System.out.println("姓名："+s.getName());
            System.out.println("性别："+s.getSex());
            System.out.println("成绩："+s.getScore());
        }

    }

    @Override
    public void printAverageScore(ArrayList<Student> student) {
        double allScore=0;
        for (int i = 0; i < student.size(); i++) {
            Student s=student.get(i);
            allScore+=s.getScore();
        }
        System.out.println("平均分为："+(allScore/student.size()));

    }
}
